{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">
            <section class="panel">
                <div class="panel-heading" style="padding:0.8em;">
                    <b>菜单权限(不选择任何权限为拥有所有权限)</b>
                </div>
                <section class="panel panel-padding">

                        {foreach name="AdminMenu" item="vo"}
                        <div class="layui-form-item">
                            <label class="layui-form-label">{$vo.name}</label>
                            <div class="layui-input-block">
                                <input type="checkbox" lay-filter="checkbox" {in name="vo.id" value="$menu_purview"}checked{/in} value="{$vo.id}" class="checkAll" name="menu_purview[{$vo.id}]" title="{$vo.name}">
                                {foreach name="vo.sub" item="v" key='k'}
                                <input type="checkbox" value="{$v.id}" {in name="v.id" value="$menu_purview"}checked{/in} name="menu_purview[{$v.id}]" title="{$v.name}">
                                {/foreach}
                            </div>
                        </div>
                        {/foreach}
                </section>
            </section>
                <section class="panel">
                    <div class="panel-heading" style="padding:0.8em;">
                        <b>操作权限 (勾选模块后后面的权限才会生效，不选择任何权限为拥有所有权限)</b>
                    </div>
                    <section class="panel panel-padding">
                        {foreach name="AdminPurvew" item="vo"}
                        <div class="layui-form-item">
                            <label class="layui-form-label">{$vo.name}</label>
                            {foreach name="vo.sub" item="v" key='k'}
                            <div class="layui-input-block">
                                <input type="checkbox" lay-filter="checkbox" title="{$v.name}">
                                {notempty name="v.act"}
                                    {foreach name="v.act" item="vv" key='kk'}
                                    <input type="checkbox" lay-filter="" name="base_purview[{$v.id}_{$kk}]" title="{$vv.name}" value="{$vv.act}" {in name="$vv.act" value="$base_purview"}checked{/in}>
                                    {/foreach}
                                {/notempty}
                            </div>
                            {/foreach}
                        </div>
                        {/foreach}
                    </section>
                </section>

                <div class="layui-input-block">
                    <input type="hidden" name="group_id" type="hidden" value="{$info.group_id}">
                    <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script>
    layui.use('pageform', function(){
        var form = layui.form();
        var $= layui.jquery;
        //各种基于事件的操作，下面会有进一步介绍
        form.on('checkbox(checkbox)', function(data){
            var child = $(data.elem).parents('.layui-input-block').find('input[type="checkbox"]');
            child.each(function(index, item){
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });


    });
</script>
{/block}